package com.toe.recommend.webapi.pojo;

import com.toe.pojo.vo.user.UserHistoryVO;
import lombok.Data;

import java.util.Objects;

@Data
public class HistoryKey {

    private Long userId;
    private Long goodsId;

    public HistoryKey() { }

    public HistoryKey(Long userId, Long goodsId) {
        this.userId = userId;
        this.goodsId =goodsId;
    }

    @Override
    public boolean equals(Object o) {
        HistoryKey history = (HistoryKey) o;
        Long userId = history.getUserId();
        Long goodsId = history.getGoodsId();

        return this.userId.equals(userId) && this.goodsId.equals(goodsId);
    }

    public boolean equalsUserId(Long userId) {
        return this.userId.equals(userId);
    }

    public boolean equalsGoodsId(Long goodsId) {
        return this.goodsId.equals(goodsId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userId, goodsId);
    }
}
